home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-06-19 | 855 b | 46 lines | [TEXT/MPS ] |
- #include <resources.h>
- #include <memory.h>
-
- #include "inttypes.h"
- #include "rawdrive.h"
- #include "bootblock.h"
-
- bootblock::bootblock()
- {
- uint32 position=0;
-
- Handle res= GetResource('Boot',128);
- if ( res == 0 )
- return;
- insert( res, position );
-
- res= GetResource('Boot',129);
- if ( res == 0 )
- return;
- insert( res, position );
-
- zero( position );
- }
-
- OSErr bootblock::install( const FSSpec& volume )
- {
- rawdrive drive(volume);
- uint32 amount= sizeof(data);
- return drive.write( 0, data, amount );
- }
-
- void bootblock::insert( Handle h, uint32& position )
- {
- uint32 oldposition= position;
- position+= GetHandleSize(h);
- if ( position > sizeof(data) )
- position= sizeof(data);
- BlockMove( *h, data+oldposition, position-oldposition );
- }
-
- void bootblock::zero( uint32 from )
- {
- for ( ; from < sizeof(data); from++ )
- data[from]=0;
- }
-